package com.longcai.controller.homegood;


import com.alibaba.fastjson.JSONObject;
import com.longcai.bean.ApiResult;
import com.longcai.entity.homegood.ClyjGoodsBrand;
import com.longcai.service.homegood.ClyjGoodsBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 商品品牌表 前端控制器
 * </p>
 *
 * @author LWK
 * @since 2019-03-22
 */
@Controller
@RequestMapping("/clyjGoodsBrand")
public class ClyjGoodsBrandController {

    @Autowired
    private ClyjGoodsBrandService clyjGoodsBrandService;

    /**
     * 查询所有品牌
     *
     * @return
     */
    @ResponseBody
    @RequestMapping("/getallbrand")
    public ApiResult getallbrand() {

        return this.clyjGoodsBrandService.getallbrand();
    }

    /**
     * 品牌墙
     *
     * @param params
     * @return
     */
    @RequestMapping("/getbrandgoods")
    @ResponseBody
    public ApiResult getbrandgoods(@RequestBody JSONObject params) {
        //分类id
        String id = params.getString("id");
        if (id == null || id.equals("")) {
            return ApiResult.fail("查询失败");
        }
        return this.clyjGoodsBrandService.getbrandgoods(id);
    }
}

